﻿using System.Collections.ObjectModel;
using System.Windows.Media;
using HandyControl.Data;
using HandyControl.Tools;
using JY.Wpf.Core.Tools;
using JY.Wpf.Core.ViewModelBases;
using JY.Wpf.Test.Views.ControlDemoViews;
using SD.IOC.Core.Mediators;

namespace JY.Wpf.Test.ViewModels.ControlDemoViewModels
{
    [NotifyPropertyChanged]
    public class CoverViewDemoViewModel : ViewModelBase
    {
        #region # 变量
        
        #endregion

        #region # 构造器
        /// <summary>
        /// 构造器
        /// </summary>
        public CoverViewDemoViewModel()
        {
            this.DataList = this.GetCoverViewDemoDataList();
        }
        #endregion

        #region # 属性

        public ObservableCollection<CoverViewDemoModel> DataList { get; set; }

        #endregion

        #region # Command方法

        #endregion

        #region # 方法
        private ObservableCollection<CoverViewDemoModel> GetCoverViewDemoDataList()
        {
            return new ObservableCollection<CoverViewDemoModel>
            {
                new CoverViewDemoModel
                {
                    ImgPath = "/JY.Wpf.Test;component/Images/Album/1.jpg",
                    BackgroundBrush = ResourceHelper.GetResource<Brush>(ResourceToken.SuccessBrush) 
                },
                new CoverViewDemoModel
                {
                    ImgPath = "/JY.Wpf.Test;component/Images/Album/2.jpg",
                    BackgroundBrush =ResourceHelper.GetResource<Brush>(ResourceToken.PrimaryBrush)
                },
                new CoverViewDemoModel
                {
                    ImgPath = "/JY.Wpf.Test;component/Images/Album/3.jpg",
                    BackgroundBrush = ResourceHelper.GetResource<Brush>(ResourceToken.WarningBrush)
                },
                new CoverViewDemoModel
                {
                    ImgPath = "/JY.Wpf.Test;component/Images/Album/4.jpg",
                    BackgroundBrush = ResourceHelper.GetResource<Brush>(ResourceToken.DangerBrush)
                },
                new CoverViewDemoModel
                {
                    ImgPath = "/JY.Wpf.Test;component/Images/Album/5.jpg",
                    BackgroundBrush = ResourceHelper.GetResource<Brush>(ResourceToken.SuccessBrush)
                },
                new CoverViewDemoModel
                {
                    ImgPath = "/JY.Wpf.Test;component/Images/Album/6.jpg",
                    BackgroundBrush = ResourceHelper.GetResource<Brush>(ResourceToken.PrimaryBrush)
                },
                new CoverViewDemoModel
                {
                    ImgPath = "/JY.Wpf.Test;component/Images/Album/7.jpg",
                    BackgroundBrush = ResourceHelper.GetResource<Brush>(ResourceToken.InfoBrush)
                },
                new CoverViewDemoModel
                {
                    ImgPath = "/JY.Wpf.Test;component/Images/Album/8.jpg",
                    BackgroundBrush = ResourceHelper.GetResource<Brush>(ResourceToken.WarningBrush)
                },
                new CoverViewDemoModel
                {
                    ImgPath = "/JY.Wpf.Test;component/Images/Album/9.jpg",
                    BackgroundBrush = ResourceHelper.GetResource<Brush>(ResourceToken.PrimaryBrush)
                },
                new CoverViewDemoModel
                {
                    ImgPath = "/JY.Wpf.Test;component/Images/Album/1.jpg",
                    BackgroundBrush = ResourceHelper.GetResource<Brush>(ResourceToken.DangerBrush)
                }
            };
        }
        #endregion

        #region # 获取页面 —— object GetView(object context = null)
        /// <summary>
        /// 获取页面
        /// </summary>
        /// <param name="context">页面</param>
        /// <returns></returns>
        public override object GetView(object context = null)
        {
            return ResolveMediator.Resolve<CoverViewDemoView>();
        }
        #endregion
    }
    [NotifyPropertyChanged]
    public class CoverViewDemoModel
    {
        public string ImgPath { get; set; }

        public Brush BackgroundBrush { get; set; }
    }
}
